﻿using System;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DataSet1TableAdapters;

public partial class MasterPage : System.Web.UI.MasterPage
{
    public string MetaPageTitle
    {
        get
        {
            return PageTitle.Content;
        }
        set
        {
            PageTitle.Content = value;
        }
    }
    public string MetaPageURL
    {
        get
        {
            return PageUrl.Content;
        }
        set
        {
            PageUrl.Content = value;
        }
    }
    public string MetaPageImage
    {
        get
        {
            return PageImage.Content;
        }
        set
        {
            PageImage.Content = value;
        }
    }
    public string MetaDescription
    {
        get
        {
            return PageDescription.Content;
        }
        set
        {
            PageDescription.Content = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        nedBildeTableAdapter nedBildeTa = new nedBildeTableAdapter();
        DataSet1.nedBildeDataTable nedBildeDa = new DataSet1.nedBildeDataTable();

        nedBildeDa = nedBildeTa.GetnedBilde();

        HttpContext.Current.Session["info"] = nedBildeDa[0].info;
        HttpContext.Current.Session["imgSmall"] = nedBildeDa[0].imgSmall;
        HttpContext.Current.Session["imgBig"] = nedBildeDa[0].imgBig;
        if (Page.IsPostBack == false)
        {
            if (Session["Reklama"] == "1")
            {
                Session["Reklama"] = "0";
            }
            else if (Session["Reklama"] == "0")
            {
                Session["Reklama"] = "1";
            }
            else
            {
                Random a = new Random();
                int Nr = 0;
                Nr = a.Next();
                Nr = Nr & 1;
                if (Nr == 1)
                {
                    Session["Reklama"] = "1";
                }
                else
                {
                    Session["Reklama"] = "0";
                }
            }
        }
    }
}
